package com.nnxy.worktostudy.system.service.impl;

import com.nnxy.worktostudy.system.entity.Menu;
import com.nnxy.worktostudy.system.mapper.MenuMapper;
import com.nnxy.worktostudy.system.service.MenuService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author luye
 * @since 2021-09-26
 */
@Service
public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu> implements MenuService {

    @Override
    public List<String> selectPermissionValueByUserId(Long id) {
        List<String> result = new ArrayList<>();
        for (String permissionValue: baseMapper.selectPermissionValueByUserId(id)) {
            if (permissionValue != null && permissionValue.length() > 0) {
                result.add(permissionValue);
            }
        }
        return result;
    }


}
